# Maintainer: Alexey Pavlov <alexpux@gmail.com>
# Contributor: Ray Donnelly <mingw.android@gmail.com>

_realname=ack
pkgname=perl-${_realname}
pkgver=3.2.0
pkgrel=1
pkgdesc="A Perl-based grep replacement, aimed at programmers with large trees of heterogeneous source code"
arch=('any')
url="https://beyondgrep.com/"
license=('GPL' 'PerlArtistic')
depends=('perl-File-Next')
groups=('perl-modules')
options=(!emptydirs)
source=("https://www.cpan.org/authors/id/P/PE/PETDANCE/${_realname}-v${pkgver}.tar.gz"
        '0002-ack-2.12-match-makefiles-with-more-generality.patch')
sha256sums=('5a070954513c1a6c5622d3b83ee3ddd04b5733f96c761f216d539193f284db03'
            '3f2bec65a174465babb5fef6c179ae25b7d85bee2263683396b574c3d3d33cab')
prepare() {
  cd "${srcdir}/${_realname}-v${pkgver}"
  patch -p1 -i ${srcdir}/0002-ack-2.12-match-makefiles-with-more-generality.patch
}

build() {
  cd "${srcdir}/${_realname}-v${pkgver}"
  PERL_MM_USE_DEFAULT=1 perl Makefile.PL INSTALLDIRS=vendor
  make
}

check() {
  cd "${srcdir}/${_realname}-v${pkgver}"
  # some standalone tests are failing
  make test || true
}

package() {
  cd "${srcdir}/${_realname}-v${pkgver}"
  make install DESTDIR="${pkgdir}"
}
